/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package program;

import avenue.MyWindowEvent;
import avenue.messageBox;
import java.awt.Color;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;
import javax.persistence.EntityManager;
import javax.swing.JFrame;
import model.DBManager;
import model.Program;
import model.ProgramRate;
import model.Station;

/**
 *
 * @author Aggelos
 */
public class EditProgramForm extends javax.swing.JFrame {

    /**
     * Creates new form EditProgramForm
     */
    public EditProgramForm() {
        em = DBManager.em;
        if ( !em.getTransaction().isActive()){
            em.getTransaction().begin();
        }
        initComponents();
        if (readOnly) {
            jLabel16.setText("Δημιουργία νέου Προγράμματος");
        }
        else
        {jLabel16.setText("Επεξεργασία Προγράμματος");}
         getContentPane().setBackground(Color.white);
        //Στοιχιση στο κέντρο 24/2/2013
        setLocationRelativeTo(null);
    }
    
    public EditProgramForm(Program p,  boolean readOnly) {
        em = DBManager.em;
        program1=p;
        this.readOnly = readOnly;
        if ( !(em.getTransaction().isActive()) ){
            em.getTransaction().begin();
        }
        initComponents();
        if (readOnly) {
            jLabel16.setText("Δημιουργία νέου Προγράμματος");
        }
        else
        {jLabel16.setText("Επεξεργασία Προγράμματος");}
         getContentPane().setBackground(Color.white);
        //Στοιχιση στο κέντρο 24/2/2013
        setLocationRelativeTo(null);
        //org.jdesktop.observablecollections.ObservableCollections.observableList(customerQuery.getResultList());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        station2 = new model.Station();
        program2 = program1;
        query1 = java.beans.Beans.isDesignTime() ? null : em.createQuery("select s from Station s");
        list1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query1.getResultList());
        stationBoxRenderer1 = new avenue.StationBoxRenderer();
        query2 = em.createQuery("select pr from ProgramRate pr where pr.stationId=:station and pr.programId=:program").setParameter("station", station2).setParameter("program", program2);
        list2 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query2.getResultList());
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        programIdTextField = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        perigrafiTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        freepassText = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        requiredText = new javax.swing.JTextField();

        stationBoxRenderer1.setText("stationBoxRenderer1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Σταθμός: ");

        jLabel2.setText("Διόδια που εισπράτονται ανά κατηγορία οχήματος");

        jLabel8.setText("Τίτλος :");

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/cancel.gif"))); // NOI18N
        jButton4.setText("Ακυρο");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.gif"))); // NOI18N
        jButton5.setText("Αποθήκευση");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, program2, org.jdesktop.beansbinding.ELProperty.create("${name}"), programIdTextField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jComboBox1.setRenderer(stationBoxRenderer1);

        org.jdesktop.swingbinding.JComboBoxBinding jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list1, jComboBox1, "stationBoxBinding");
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, station2, org.jdesktop.beansbinding.ObjectProperty.create(), jComboBox1, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"), "stationBinding");
        bindingGroup.addBinding(binding);

        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jTable1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list2, jTable1, "");
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${categoryId.description}"));
        columnBinding.setColumnName("Κατηγορία");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${rate}"));
        columnBinding.setColumnName("Τιμη");
        columnBinding.setColumnClass(java.math.BigDecimal.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane1.setViewportView(jTable1);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, program2, org.jdesktop.beansbinding.ELProperty.create("${description}"), perigrafiTextField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jLabel9.setText("Περιγραφή :");

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel16.setText("Διαχείριση Προγραμμάτων");

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/imagesCAL4A9SX.jpg"))); // NOI18N

        jLabel15.setFont(new java.awt.Font("Snap ITC", 1, 24)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(0, 3, 130));
        jLabel15.setText("TelePass 1.0");

        jLabel10.setText("Δωρεάμ Διελεύσεις :");

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, program2, org.jdesktop.beansbinding.ELProperty.create("${freePass}"), freepassText, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        freepassText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                freepassTextActionPerformed(evt);
            }
        });
        freepassText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                freepassTextFocusLost(evt);
            }
        });

        jLabel11.setText("Προαπαιτούμενες διελεύσεις :");

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, program2, org.jdesktop.beansbinding.ELProperty.create("${freePassRequired}"), requiredText, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        requiredText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                requiredTextActionPerformed(evt);
            }
        });
        requiredText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                requiredTextFocusLost(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6)
                .addComponent(jLabel15)
                .addGap(35, 35, 35)
                .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 680, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jLabel8)
                .addGap(4, 4, 4)
                .addComponent(programIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(49, 49, 49)
                .addComponent(jLabel9)
                .addGap(4, 4, 4)
                .addComponent(perigrafiTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(freepassText, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(96, 96, 96)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(requiredText, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jLabel1)
                .addGap(4, 4, 4)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addComponent(jLabel2))
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 487, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addComponent(jLabel16)))
                .addGap(16, 16, 16)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel8)
                    .addComponent(programIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(perigrafiTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel10)
                    .addComponent(freepassText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(requiredText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(6, 6, 6)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addComponent(jButton5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4)
                .addContainerGap())
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        MyWindowEvent we = new MyWindowEvent(this, WindowEvent.WINDOW_CLOSED,false);
        for (WindowListener l : this.getWindowListeners()) {
            l.windowClosed(we);
       }
        dispose();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        //ΕΛΕΓΧΟΣ ΤΙΜΩΝ ΣΤΟ ProgramRate*********************
        ProgramRate pr ;
        boolean breakRate=false;//Μεταβλήτη για το αν βρήκε άδειο 
     
        for (int i=0;i<list1.size();i++){ //για όλου τους σταθμούς
          station1=(Station)(list1.get(i));
          query2 = em.createQuery("select pr from ProgramRate pr where pr.stationId=:station and pr.programId=:program").setParameter("station", station1).setParameter("program", program2);
           List<ProgramRate> list3 = query2.getResultList();
           //Παραπάνω βρίσκει τα ProgramRate ενός σταθμου
           
            breakRate=false;
           Iterator ipr =list3.iterator();
                
                  while(ipr.hasNext()) {// Πέρνα από όλα τα στοιχεια της λιστας με τα Rates του συγκεκριμένου σταθμου
                    ProgramRate pr1 = (ProgramRate) ipr.next();
                
                    BigDecimal rate=  pr1.getRate();
                    try{
                    float rate2=rate.floatValue();// Αν δεν εχει βάλει χρήματα τότε θα χτυπήσει και
                    }catch (NullPointerException  e){// θα ενημερωθεί ο χρήστης
                        messageBox.infoBox("Δεν εχετε ορίσει τιμη για τον σταθμο " +station1.getDescription()+ " και για την κατηγορία "+ pr1.getCategoryId().getDescription());
                        breakRate=true;// Υπάρχει λάθος 
                        break;
                    };
                   } 
          
                if  (breakRate){break;}//Αν βρήκες το πρώτο άδειο σταθμό τότε βγες από το loop
           
      }
             
        
        
        //***************************
        //Χρησιμοποιώ και εδω την breakRate για τον ελεγχο του άδειου TextField
        //αν και το όνομα δεν ταιριαζει 
         if ("".equals(perigrafiTextField.getText())){
            messageBox.infoBox("Δεν έχετε πληκτρολογήσει Περιγραφή");
            breakRate=true;}
            
        if ("".equals(programIdTextField.getText())){
            messageBox.infoBox("Δεν έχετε πληκτρολογήσει Τίτλο");
            breakRate=true;}
        
        try { //Ειναι αριθμός
              int t = Integer.parseInt(freepassText.getText()); 
              }
        catch (NumberFormatException nfe) {
          messageBox.infoBox("Ό προαπαιτούμενος αριθμός διελεύσεων δεν είναι έγκυρος");
           freepassText.requestFocusInWindow();
            breakRate=true;
            }
        
        
        try { //Ειναι αριθμός
              int t = Integer.parseInt(requiredText.getText()); 
            }
        catch (NumberFormatException nfe) {
             messageBox.infoBox("Ό προαπαιτούμενος αριθμός διελεύσεων δεν είναι έγκυρος");
             requiredText.requestFocusInWindow();
            breakRate=true;
            }
        
        
        //ΤΕΛΟΣ ΕΛΕΓΧΩΝ
        
       if  (breakRate==false){// Δεν υπάρχει λάθος στις πληκτρολογήσεις
        
        MyWindowEvent we = new MyWindowEvent(this, WindowEvent.WINDOW_CLOSED,true);
        for (WindowListener l : this.getWindowListeners()) {
            l.windowClosed(we);
        }
       
        dispose();
    }//GEN-LAST:event_jButton5ActionPerformed
  }
    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
        if(list1.size()>0 && jComboBox1.getSelectedIndex()!=-1){
            station1=(Station)(list1.get(jComboBox1.getSelectedIndex()));
            query2 = em.createQuery("select pr from ProgramRate pr where pr.stationId=:station and pr.programId=:program").setParameter("station", station1).setParameter("program", program2);
           List<ProgramRate> list3 = query2.getResultList();
            if (list3.size()>0){
                list2.clear();
                for (ProgramRate pr : list3){
                 list2.add(pr);  
               }
            } 
        }
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void freepassTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freepassTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_freepassTextActionPerformed

    private void freepassTextFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_freepassTextFocusLost
      
        try { //Ειναι αριθμός
              int t = Integer.parseInt(freepassText.getText()); 
               
            }
        catch (NumberFormatException nfe) {
          messageBox.infoBox("Ό αριθμός δωρεάν διελεύσεων δεν είναι έγκυρος");
           freepassText.requestFocusInWindow();
            }
                                   
    }//GEN-LAST:event_freepassTextFocusLost

    private void requiredTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_requiredTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_requiredTextActionPerformed

    private void requiredTextFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_requiredTextFocusLost
       try { //Ειναι αριθμός
              int t = Integer.parseInt(requiredText.getText()); 
               
            }
        catch (NumberFormatException nfe) {
          messageBox.infoBox("Ό προαπαιτούμενος αριθμός διελεύσεων δεν είναι έγκυρος");
           requiredText.requestFocusInWindow();
            }
                                   
    
    }//GEN-LAST:event_requiredTextFocusLost

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EditProgramForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EditProgramForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EditProgramForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EditProgramForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new EditProgramForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField freepassText;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTable jTable1;
    private java.util.List<Station> list1;
    private java.util.List<ProgramRate> list2;
    private javax.swing.JTextField perigrafiTextField;
    private model.Program program2;
    private javax.swing.JTextField programIdTextField;
    private javax.persistence.Query query1;
    private javax.persistence.Query query2;
    private javax.swing.JTextField requiredText;
    private model.Station station2;
    private avenue.StationBoxRenderer stationBoxRenderer1;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
    EntityManager em;
    ProgramRate pr;
    Program program1;
    Station station1;
    JFrame thisFrame;
    boolean readOnly;
}
